<?php
/**
 * Created by PhpStorm.
 * User: apple
 * Date: 2020/10/21
 * Time: 6:14 PM
 */
namespace app\service;

use app\model\Wx;
use extend\wx\Crypt;
use extend\wx\WXBizDataCrypt;
use think\facade\Config;
use think\facade\Log;
use think\Service;
use tool\Curl;
use wx\WxCrypt;
class TxService
{
    protected static $ak;

    public function __construct()
    {
        $config = Config::get('baidu');
        self::$ak = $config['appkey'];
    }


    /*
     * 获取地理信息
     */
    public function getGeocoding($address){

        $uri = "https://apis.map.qq.com/ws/geocoder/v1/?address=%s&output=json&key=%s";

        $api = sprintf($uri,$address,self::$ak);

        $rt = Curl::get($api);
        if($rt && $rt['status'] == 0){
            //成功
            return $rt['result']['location'];
        }

        return false;
    }
}